package com.api.shopapi.service.impl;


import com.api.shopapi.entity.AskAnswerName;
import com.api.shopapi.mapper.AskAnswerNameMapper;
import com.api.shopapi.service.AskAnswerNameService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("AskAnswerNameServiceImplOne")
public class AskAnswerNameServiceImpl implements AskAnswerNameService {

    @Autowired
    private AskAnswerNameMapper askAnswerNameMapper;

    @Override
    public
    int insert(AskAnswerName askAnswerName){
        return askAnswerNameMapper.insert(askAnswerName);
    }

    @Override
    public
    int delete(String askAnswerNameCode){
        return askAnswerNameMapper.delete(askAnswerNameCode);
    }

    @Override
    public
    int update(AskAnswerName askAnswerName){
        return askAnswerNameMapper.update(askAnswerName);
    }

    @Override
    public AskAnswerName getByAskAnswerNameCode(String askAnswerNameCode){
        return askAnswerNameMapper.getByAskAnswerNameCode(askAnswerNameCode);
    }

    @Override
    public
    List<AskAnswerName> listByCommandCenterCode(String commandCenterCode){
        return askAnswerNameMapper.listByCommandCenterCode(commandCenterCode);
    }

    @Override
    public
    List<AskAnswerName> listByGovCodeType(String govCode,String type){
        return askAnswerNameMapper.listByGovCodeType(govCode,type);
    }

    @Override
    public
    PageInfo<AskAnswerName> pageByCommandCenterCode(int pageIndex, int pageSize, String commandCenterCode){
        PageHelper.startPage(pageIndex,pageSize);
        List<AskAnswerName> complaintList =askAnswerNameMapper.listByCommandCenterCode(commandCenterCode);
        return new PageInfo<>(complaintList);
    }

    @Override
    public
    PageInfo<AskAnswerName> pageByGovCodeType(int pageIndex, int pageSize,
                                              String governmentCode,String type){
        PageHelper.startPage(pageIndex,pageSize);
        List<AskAnswerName> complaintList =askAnswerNameMapper.listByGovCodeType(governmentCode,type);
        return new PageInfo<>(complaintList);
    }


}
